package com.kanqiubao.kq.adapter.user;

import android.widget.ProgressBar;

import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.kanqiubao.kq.R;
import com.kanqiubao.kq.adapter.BaseAdapter;

import org.jetbrains.annotations.NotNull;

public class UserRwListAdapter extends BaseAdapter<String> {
    public UserRwListAdapter() {
        super(R.layout.user_rw_list_item_layout);
    }

    @Override
    protected void convert(@NotNull BaseViewHolder baseViewHolder, String s) {
        baseViewHolder.setText(R.id.tian, s);
        if (baseViewHolder.getLayoutPosition() == 0) {
            baseViewHolder.setVisible(R.id.img, true);
            ((ProgressBar) baseViewHolder.getView(R.id.progress_id)).setProgress(50);
        } else {
            baseViewHolder.setVisible(R.id.img, false);
            ((ProgressBar) baseViewHolder.getView(R.id.progress_id)).setProgress(0);
        }
        if (baseViewHolder.getLayoutPosition() == getItemCount()-1) {
            baseViewHolder.setVisible(R.id.progress_id, false);
        } else {
            baseViewHolder.setVisible(R.id.progress_id, true);
        }
    }
}
